<?php
if(isset($_REQUEST['cate_id'])){
	$v_cate_id=$_REQUEST['cate_id'];
}
if(isset($_REQUEST['agency_id'])){
	$v_agency_id=$_REQUEST['agency_id'];
}

if(isset($_REQUEST['offset'])){
	$v_offset=$_REQUEST['offset'];
}
else
	$v_offset=1;
$v_limit = CONST_LIMIT_QA_PER_PAGE;
if(isset($_REQUEST['page'])){
	$page=$_REQUEST['page'];
}
else
	$page=1;
	
if(_is_sqlserver()){	
	$cmd = @mssql_init("ONEGATE_QACountByAgencyCate",$conn);
	@mssql_bind($cmd,"@p_agency_id",$v_agency_id,SQLVARCHAR);	
	@mssql_bind($cmd,"@p_cate_id",$v_cate_id,SQLINT4);
	$resoult = @mssql_execute($cmd);
	$arr_resoult = _get_row_to_array($resoult); 
	@mssql_free_result($resoult);
	$v_cate_name = $arr_resoult['0']['2'];
	$v_agency_name = $arr_resoult['0']['1'];
	$v_total_qa_count = $arr_resoult['0']['0'];
	
	$pager  = Pager::getPagerData($v_total_qa_count, $v_limit, $page);
	$page   = $pager->page;
  	$offset = $pager->offset +1; 
  	$limit = $pager->limit;
	
	$sql = "Exec ONEGATE_QAGetAllByCateAgency " ;
	$sql = $sql . $v_agency_id .",";
	$sql = $sql . $v_cate_id .",";
	$sql = $sql . $offset .",";
	$sql = $sql . $limit ;
	$ado_conn->SetFetchMode(ADODB_FETCH_NUMBER);
	$arr_all_qa_by_cate = $ado_conn->GetAll($sql);
}
?>